package Maven1.RedisJava;

import java.util.List;

import net.sf.json.JSONArray;
import net.sf.json.JSONObject;
import redis.clients.jedis.Jedis;

/**
 * Hello world!
 *
 */
public class App {
	public static void main(String[] args) {
		Jedis jedis = new Jedis("127.0.0.1", 6379);
		// jedis.set("name", "zhangsan");
		// String name = jedis.get("name");
		// System.out.println(name);
		System.out.println("---------------------");
		jedis.lpush("po", "{id:1;name:lisi}");
		jedis.lpush("po", "{id:2;name:王五}");
		jedis.lpush("po", "{id:3;name:赵六}");
		List<String> list = jedis.lrange("po", 0, -1);
		//System.out.println(list);
//		JSONArray json = JSONArray.fromObject(list);
//		if(json.size()>0){			
//			for (int i = 0; i <json.size(); i++) {		
//				JSONObject obj = json.getJSONObject(i);
//				System.out.println(obj.get("id")+"=");
//				System.out.println(obj.get("name")+"=");
//			}
//		}
	}
}